import configparser

class ini:
    def __init__(self, src=''):
        self.config = configparser.ConfigParser()
        if src == '':
            src = 'config.ini'
        self.config.read(src)

    def getNamePass(self):
        sections = self.config.sections();
        arr = [];
        for section in sections:
            conf = {};
            conf['name'] = self.config.get(section, 'name')
            conf['pass'] = self.config.get(section, 'pass')
            arr.append(conf)
        return arr

    def setSeeOk(self, args):

        self.config = configparser.ConfigParser()
        src = 'see_ok.ini'
        self.config.read(src)
        has_s = self.config.has_section('see_ok')

        if bool(1-has_s):
            self.config.add_section('see_ok')

        has_o = self.config.has_option('see_ok', args)

        if bool(1-has_o):
            self.config.set('see_ok', args, 'true')

        self.config.write(open(src, 'w'))

    def hasSeeOk(self, args):
        config = configparser.ConfigParser()
        config.read('see_ok.ini')
        return config.has_option('see_ok', args)
        
        

    

